<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>注册</title>
	[#include "/theme/adminlte/common/sites.html" /]
	[@header /]
	<link rel="stylesheet" href="${httpsurl}plugins/sweetalert/sweetalert.css">
</head>
<!-- ADD THE CLASS layout-top-nav TO REMOVE THE SIDEBAR. -->
<body class="hold-transition skin-blue layout-top-nav">
<div class="wrapper">

	<header class="main-header">
		[@nav 1 /]
	</header>
	<!-- Full Width Column -->
	<div class="content-wrapper">
		<div class="container">
			<!-- Main content -->
			<section class="content">
				<div class="box box-default box-solid">
					<form id="form" class="form-horizontal" method="post"
						  action="${httpsurl}register.htm">
						<div class="box-body">
							<h2 class="form-signin-heading">请填写正确信息</h2>
							<div class="form-group">
								<label class="col-sm-2 control-label" for="inputEmail">用户Email</label>
								<div class="col-sm-10">
									<input
									name="username" type="email" autofocus="" required=""
									placeholder="用户Email" class="form-control" id="inputEmail">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label" for="inputPassword">密码</label>
								<div class="col-sm-10">
									<input type="password" name="password" required="" placeholder="密码"
										class="form-control" id="inputPassword">
								</div>
							</div>
							<div class="form-group has-feedback">
								<label  class="col-sm-2 control-label" >完成验证：</label>
								<div id="captcha" class="col-sm-10">
									<div id="text">
										行为验证™ 安全组件加载中
									</div>
									<div id="wait" class="show">
										<div class="loading">
											<div class="loading-dot"></div>
											<div class="loading-dot"></div>
											<div class="loading-dot"></div>
											<div class="loading-dot"></div>
										</div>
									</div>
								</div>
							</div>
							<div class="box-footer">
								<button id="btn" type="button" class="btn  btn-primary pull-right">注册</button>
							</div>

						</div>
					</form>
				</div>
			</section>
			<!-- /.content -->
		</div>
		<!-- /.container -->
	</div>
	<!-- /.content-wrapper -->

	[@footer /]
</div>
<!-- ./wrapper -->

<!-- jQuery 2.2.3 -->
<script src="${httpsurl}plugins/jQuery/jquery-2.2.3.min.js"></script>
<!-- Bootstrap 3.3.6 -->
<script src="${httpsurl}bootstrap/js/bootstrap.min.js"></script>
<!-- iCheck -->
<script src="${httpsurl}plugins/iCheck/icheck.min.js"></script>
<script src="${httpsurl}plugins/sweetalert/sweetalert.min.js"></script>
<script src="${httpsurl}dist/js/gt.js"></script>

<script>
    $(function () {
        $('input').iCheck({
            checkboxClass: 'icheckbox_square-blue',
            radioClass: 'iradio_square-blue',
            increaseArea: '20%' // optional
        });
    });




    var handler = function (captchaObj) {
        captchaObj.appendTo('#captcha');
        captchaObj.onReady(function () {
            $("#wait").hide();
            $("#text").hide();
            $("#wait").removeClass("show");
        });

        $('#btn').click(function () {
            var result = captchaObj.getValidate();
            if (!result) {
                return alert('请完成验证');
            }
            $("#form").submit();
        })
        // 更多前端接口说明请参见：http://docs.geetest.com/install/client/web-front/
    };
    $.ajax({
        url: "${siteurl}startcaptcha.htm?t=" + (new Date()).getTime(),
        type: "get",
        dataType: "json",
        success: function (data) {
            //请检测data的数据结构， 保证data.gt, data.challenge, data.success有值
            initGeetest({
                // 以下配置参数来自服务端 SDK
                gt: data.gt,
                challenge: data.challenge,
                offline: !data.success,
                new_captcha: true
            }, handler)
        }
    })
        [#if msg?? ]
    swal("Oops!", "${msg}", "error")
        [/#if]
</script>
</body>
</html>
